//
//  CarConditionViewController.m
//  carcareIOS
//
//  Created by wr on 15/7/15.
//  Copyright (c) 2015年 baozun. All rights reserved.
//

#import "CarConditionViewController.h"
#import "CarFenceViewController.h"
#import "SetVoltageViewController.h"

#import "MapLBS.h"
#import "NetCar.h"
#import "RefreshMgr.h"
#import "CarLocateViewController.h"

#import "Check.h"

#import "CarFenceDetailViewController.h"

#import "AISystemInfo.h"

#import "BaseWebViewController.h"

#import "ADHelper.h"

#import "NetViolations.h"

//挣点商城
#import "NetMoneyMall.h"
#import "CreditWebViewController.h"

#import "MessageCenterViewController.h"

#import "CarConditionHeadView.h"
#import "CarConditionScrollView.h"

#import "NotifiCationViewController.h"

#import "SetVoltageViewController.h"

//#import "FuelMainViewController.h"
#import "FuelMainTabViewController.h"

#import "ViolationCarsViewController.h"

#import "CarConditionBPanView.h"
#import "CarMallHeadView.h"
#import "CarMallIconBtnV.h"
#import "NetLBS.h"

#import "WebViewHandle.h"

#import "MessageCenterManager.h"

//#import "MoveCarInputViewModel.h"
//#import "MoveCarInputViewController.h"

#import "carcareIOS-Swift.h"

#define TOP_HEIGHT (__MAIN_RATIO_375 * 56)
#define CONDITON_VIEW_HEIGHT (13 * __MAIN_RATIO_375 + 25 * __MAIN_RATIO_375 + 72 * 3 * __MAIN_RATIO_H_667)

#define BOTTOM_HEIGHT (151 * __MAIN_RATIO_375)

typedef NS_ENUM(NSInteger , Button_Type)
{
    Button_OilManager = 30,//加油管理按钮
    Button_Voltage,//电压设置
//    Button_MoveCar,//智能挪车
    Button_BreakRules ,//违章查询按钮
//    Button_InvitMoney,//邀请奖励
    Button_ShockPolice ,//震动报警
    Button_MoneyMall,//挣点商城
    Button_SafeRegion,//安全区域按钮
};

@interface CarConditionViewController ()

//创建上面的 有 剩余油量 当前里程  当前电压的view
@property (nonatomic , strong) CarConditionHeadView * headView;
@property (nonatomic , strong) CarMallHeadView * mallHeadV;//头部的惦记后出现LBS店铺的页面
@property (nonatomic , strong) CarMallIconBtnV * headMallBtnV;//钣喷按钮
@property (nonatomic , strong) LBSModel * lbsModel;


@property (nonatomic , strong)UIView * bottomBackV;

@property (nonatomic ) BOOL tapOutAndInB;//滑动下方的view的变化的控制值
//@property (nonatomic) BOOL outAndInBool;

@property (nonatomic, strong) MapLBS *mapLBS;

@property (nonatomic , strong) UIButton * locMapCenterBtn;

//下方的滚动view
@property (nonatomic , strong) CarConditionScrollView * carConditionScrollView;

@property (nonatomic, strong) UILabel *maintenanceTipsL;

//违章查询
@property (nonatomic , copy) NSString * breakRulesUrlStr;

@property (nonatomic, strong) RefreshMgr *refreshMgr;

@property (nonatomic , strong) MoveCarManager * moveCarMgr;

@end

@implementation CarConditionViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"车况";
    [CommentHelper seePage:See_CarState];
    
    self.moveCarMgr = [MoveCarManager sharedInstance];
    //刷新
    self.refreshMgr = [RefreshMgr sharedInstance];

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(refreshCarLocate) name:REFRESH_CARLOCATION object:nil];

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(refreshCarStatusNotification) name:REFRESH_CARSTATUS object:nil];
    
//    self.outAndInBool = NO;
    [self setUpRightNavBtn];
    
    __weak __typeof(self) wself = self;
    
    self.mapLBS = [[MapLBS alloc] init];
    self.mapLBS.locImage = ImageNamed(@"car_loc_Corner");
    self.mapLBS.locCenterOffset = CGPointMake(0, 0);
    self.mapLBS.coordinate = self.refreshMgr.refreshCarLocation.location;
    self.mapLBS.mapView.frame = CGRectMake(0, 0, __MAIN_WIDTH, __MAIN_HEIGHT);

    UIButton * navButton = [UIButton buttonWithFrame:CGRectMake(0, 0, 100, 40) title:@"车况" textColor:[UIColor whiteColor] font:FONT_BUTTON click:^{
        if(wself.mapLBS.mapDidTouch)wself.mapLBS.mapDidTouch();
    }];
    navButton.titleLabel.font = FONT_DEFAULT_Light(20 * __MAIN_RATIO_375);
    self.navigationItem.titleView = navButton;
    
    self.mapLBS.calloutView = [LocAnnotationView rightClickCalloutViewWithRightClick:^{
        if (![Check isVisiter]) {
            CarLocateViewController *vc = [[[CarLocateViewController alloc] init] navSetupBackItemWithIdentification:BACK_ICON_TITLE];
            [wself.navigationController pushViewController:vc animated:YES];
        }
    }];
    self.mapLBS.CalloutViewUpdate = ^(UIView *view, id<MAAnnotation> annotation){
        LocRightClickCalloutView *calloutView = (LocRightClickCalloutView *)view;
        calloutView.title = @"车辆位置";
        calloutView.subTitle = annotation.subtitle;
    };
    [self.view addSubview:self.mapLBS.mapView];
    [self.mapLBS showLocation];
    self.locMapCenterBtn = [Factory buttonWithCenter:CGPointMake(40, __MAIN_HEIGHT_64_TABBAR - 40 - BOTTOM_HEIGHT) withImage:ImageNamed(@"loc_show") click:^{
        [wself.mapLBS showLocation];
    } onView:self.view];
    self.mapLBS.mapDidTouch = ^()
    {
//        [UIView animateWithDuration:0.4 animations:^{
//            [wself.carConditionScrollView setTop:(wself.outAndInBool ? __MAIN_HEIGHT_64_TABBAR : (__MAIN_HEIGHT_64_TABBAR - BOTTOM_HEIGHT))];
//            [locShowButton setTop:(wself.outAndInBool ? (__MAIN_HEIGHT_64_TABBAR - 50) : (__MAIN_HEIGHT_64_TABBAR - 50 - BOTTOM_HEIGHT))];
//        }];
//        wself.outAndInBool = ! wself.outAndInBool;
    };
    
    [self loadHeadView];
    
    [self loadBottomView];
    
    
    self.mallHeadV = [[CarMallHeadView alloc]init];
    UIWindow *mainWindow = [UIApplication sharedApplication].delegate.window;
    [mainWindow addSubview:self.mallHeadV];
    [self.mallHeadV setHidden:YES];
    self.mapLBS.Select = ^(LBSStoreModel *storeModel)
    {
        [UmengMgr event:ICZ_Store_Map_Click];
        [[StatisticsMgr sharedInstance] addClickID:@"点击地图门店" description:@""];
 
        [NSTimer scheduledTimerWithTimeInterval:0.3 block:^{
            [wself.mallHeadV setHidden:!(storeModel.modelDic.count > 0)];
            [wself.mallHeadV reloadLBSModel:storeModel mallClick:^{
                
                [UmengMgr event:ICZ_Store_Click];
                [[StatisticsMgr sharedInstance] addClickID:@"点击门店详情" description:@""];
 
                [wself clickMallPresent:storeModel];
            } cancelClick:nil];
        } repeats:NO];
        
    };
    
    
    [self loadBreakRulesUrlData];
    [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(updateCarCondition) name:REFRESH_CARCONDITION object:nil];
}
//设置右侧导航按钮
- (void)setUpRightNavBtn
{
    __weak __typeof(self) wself = self;

    [self navSetupRightImageName:@"message_icon" action:^{
        [wself.navigationController pushViewController:[MessageCenterManager sharedInstance].viewController animated:YES];
        [UmengMgr event:ICZ_CarMessage];
    }];
    if(self.navRightViews.count > 0)
    {
        UIView * righNavView = [self.navRightViews firstObject];
        RACSignal * countValidSignal = RACObserve([MessageCenterManager sharedInstance], unReadNum);
        [countValidSignal subscribeNext:^(id x) {
            [righNavView showRemind:[MessageCenterManager sharedInstance].unReadNum > 0 center:CGPointMake(righNavView.width, 0)];
        }];

    }
}
- (void)clickMallPresent:(LBSStoreModel *)storeModel
{
    
    BaseWebViewController *webVC = [[BaseWebViewController alloc]initWithURL:[WebViewHandle url:storeModel.jumpUrl addParams:@{@"icz_uid" : @(USERINFO.userID), @"icz_key" : USERINFO.iczkey}]];
    [webVC navSetupLeftTitle:@"关闭" action:^{
        [webVC dismissViewControllerAnimated:YES completion:nil];
    }];
    [self presentViewController:[UINavigationController navigationControllerWithRootViewController:webVC] animated:YES completion:nil];
}
#pragma mark - 请求LBS 数据
- (void)reloadLBSData
{
    __weak __typeof(self) wself = self;
    [NetLBS lbsInfoSuccess:^(LBSModel *model) {

        if(!model.isFit)return;
        
        wself.lbsModel = model;
        wself.mapLBS.storeModels = [NSArray arrayWithArray:model.storeModels];
        [NSTimer scheduledTimerWithTimeInterval:0.1 block:^{
            if(model.isShow)
            {
                [wself.mapLBS showStoreMap];
            }else [wself.mapLBS dissmissStoreMap];
        } repeats:NO];

        [wself.headMallBtnV reloadLBSModel:model];
        
    }];

}
- (void)updateCarCondition
{
    if(self.carConditionScrollView)
    {
        [self.carConditionScrollView reloadDetailLabelText:([self.refreshMgr.refreshCarCondition.oilMgrLastTime isNotNil] ? self.refreshMgr.refreshCarCondition.oilMgrLastTime : @"") withTagNum:Button_OilManager];
        [self.carConditionScrollView reloadDetailLabelText:(SETTINGMGR.showTipsShake ? @"状态:开" : @"状态:关") withTagNum:Button_ShockPolice];
        [self.carConditionScrollView reloadDetailLabelText:([self.refreshMgr.refreshCarCondition.carFenceMgrRadius isNotNil] ? self.refreshMgr.refreshCarCondition.carFenceMgrRadius : @"") withTagNum:Button_SafeRegion];
        [self.carConditionScrollView reloadDetailLabelText:([self.refreshMgr.refreshCarCondition.volatileSettingState isNotNil] ? self.refreshMgr.refreshCarCondition.volatileSettingState : @"") withTagNum:Button_Voltage];
    }    
}

#pragma mark - 创建底部带滚动的view
- (void)loadBottomView
{
    self.bottomBackV = [[UIView viewWithFrame:CGRectMake(0, __MAIN_HEIGHT_64_TABBAR - BOTTOM_HEIGHT - BOTTOM_PAN_HEIGHT, __MAIN_WIDTH, BOTTOM_HEIGHT + BOTTOM_PAN_HEIGHT)] setupOnView:self.view];
    
    //,@[@"邀请奖励",@"InvitMoney"]
    NSMutableArray * conditionTempArr = [NSMutableArray arrayWithCapacity:4];
    [conditionTempArr addObject:@[@"加油管理",@"oilManager",STRING_INT(Button_OilManager)]];
    [conditionTempArr addObjectsFromArray:@[@[@"电压提醒",@"voltageBtnImage",STRING_INT(Button_Voltage)],@[@"安全区域",@"safetyCircle",STRING_INT(Button_SafeRegion)],@[@"违章查询",@"breakRulesQuery",STRING_INT(Button_BreakRules)],@[@"震动报警",@"shockPolice",STRING_INT(Button_ShockPolice)],@[@"挣点商城",@"moneyMallImg",STRING_INT(Button_MoneyMall)]]];
    
    self.tapOutAndInB = YES;
    self.carConditionScrollView = [[CarConditionScrollView alloc]initWithFrame:CGRectMake(0, BOTTOM_PAN_HEIGHT, __MAIN_WIDTH, BOTTOM_HEIGHT) withDataArray:[NSArray arrayWithArray:conditionTempArr]];
    __weak __typeof(self) wself = self;
    self.carConditionScrollView.funcButtonClick = ^(UIButton * sender)
    {
        [wself receiveButtonClick:sender];
    };
    
    [self.bottomBackV addSubview:self.carConditionScrollView];
    [self panAndTapClick];
    
    //上面可滑动部分的view
    CarConditionBPanView * panHeadV = [[[CarConditionBPanView alloc]init] setupOnView:self.bottomBackV];
    panHeadV.backgroundColor = [UIColor clearColor];
    [panHeadV addTapSingleAction:^(UITapGestureRecognizer *recognizer) {
        [wself panAndTapClick];
    }];
    
    UIPanGestureRecognizer * bottomPanGesute = [[UIPanGestureRecognizer alloc]initWithTarget:self action:@selector(bottomGesute:)];
    [panHeadV addGestureRecognizer:bottomPanGesute];
}
#pragma mark -拖动下方的view 改变事件
- (void)bottomGesute:(UIPanGestureRecognizer *)panGesture
{
    if (panGesture.state == UIGestureRecognizerStateBegan) {
        [self panAndTapClick];
    }
    
}
#pragma mark - 拖动或点击下方 滑动事件
- (void)panAndTapClick
{
    [UIView animateWithDuration:0.4 animations:^{
        [self.bottomBackV setTop:(self.tapOutAndInB ? (__MAIN_HEIGHT_64_TABBAR - BOTTOM_PAN_ADD_HEIGHT - BOTTOM_PAN_HEIGHT): (__MAIN_HEIGHT_64_TABBAR - BOTTOM_HEIGHT - BOTTOM_PAN_HEIGHT))];
        [self.locMapCenterBtn setCenterY:self.tapOutAndInB ? (__MAIN_HEIGHT_64_TABBAR - 40 - BOTTOM_PAN_ADD_HEIGHT) : (__MAIN_HEIGHT_64_TABBAR - 40 - BOTTOM_HEIGHT)];
    }];
    self.tapOutAndInB = ! self.tapOutAndInB;
}
- (void)loadBreakRulesUrlData
{
    __weak __typeof(self) wself = self;
    [[NetViolations violationPayLinkWithCarInfo:nil] requestSuccess:^(id JSON)
    {
        wself.breakRulesUrlStr = JSON[@"link"];
    } failure:^(id JSON) {
        
    }];
}

-(void)refreshCarLocate{
    self.mapLBS.coordinate = self.refreshMgr.refreshCarLocation.location;
    [self.mapLBS showLocation];
}

#pragma mark - 创建头部的view
- (void)loadHeadView
{
    CGFloat headViewX = 8;
    self.headView = [[CarConditionHeadView alloc] initWithFrame:CGRectMake( headViewX , 13 * __MAIN_RATIO_375, __MAIN_WIDTH - headViewX * 2, TOP_HEIGHT)];
    [self.view addSubview:self.headView];
    NSArray * nameArray =  @[(USERINFO.adaption_Oil ? @"剩余油量" : @"今日行程"),(USERINFO.adaption_Mileage ? @"当前里程" : @"今日震动"),@"续航里程"];
    NSArray * unitArray = @[(USERINFO.adaption_Oil ? @"L" : @"个"),(USERINFO.adaption_Mileage ? @"KM" : @"次"),@"KM"];
     __weak __typeof(self) wself = self;
    [self.headView reloaNameTitles:nameArray units:unitArray click:^(NSInteger tagIndex)
    {
        [wself headFuncButtonClick:tagIndex];
    }];
    
    UIImage * mallBtnIcon = ImageNamed(@"mallBtnIconOff");//mallBtnIconOffNew mallBtnIconOn
    self.headMallBtnV = [[[CarMallIconBtnV alloc]initWithFrameXY:CGPointMake(self.headView.right - mallBtnIcon.size.width, self.headView.bottom + 11) iconImage:mallBtnIcon click:^{
        
        [UmengMgr event:ICZ_Store_Switch];
        [[StatisticsMgr sharedInstance] addClickID:@"点击门店开关" description:wself.lbsModel.isShow?@"关":@"开"];
 
        
        [NetLBS lbsResetOpen:!wself.lbsModel.isShow success:^{
            
            [wself reloadLBSData];
        }];
    }] setupOnView: self.view];
    
}
#pragma mark - 创建头部 剩余油量 当前里程 续航里程 等的按钮
- (void)headFuncButtonClick:(NSInteger)tagIndex
{

    switch (tagIndex) {
            //剩余油量 今日行程
        case 120:
            if(!USERINFO.adaption_Oil) [SCREEN changePageToWay];
            break;
            //行驶里程 今日震动
        case 121:
            
            break;
            //续航里程
        case 122:
//            [self.navigationController pushViewController:[[[SetVoltageViewController alloc] initWithMainViewType:TYPE_MAIN_VIEW_NORMAL] navSetupBackItemWithIdentification:BACK_ICON_TITLE] animated:YES];
            break;
        default:
            break;
    }
}

#pragma mark - conditionView delegate
- (void)receiveButtonClick:(UIButton *)sender
{
    //加油管理按钮 tag = 30
    //震动报警按钮 tag = 31
    //安全区域按钮 tag = 32
    //违章查询按钮 tag = 33
    //邀请奖励按钮 tag = 34
    //挣点商城按钮 tag = 35
    switch (sender.tag) {
            //加油管理按钮
        case Button_OilManager:
            [self.navigationController pushViewController:[[[FuelMainTabViewController alloc] init] navSetupBackItemWithIdentification:BACK_ICON_TITLE] animated:YES];
            [UmengMgr event:ICZ_AddOil];
            break;
            //电压设置
        case Button_Voltage:
            [self.navigationController pushViewController:[[[SetVoltageViewController alloc] initWithMainViewType:TYPE_MAIN_VIEW_NORMAL] navSetupBackItemWithIdentification:BACK_ICON_TITLE] animated:YES];
            [UmengMgr event:ICZ_VOLTAGE];
            break;
            //智能挪车按钮
//        case Button_MoveCar:
//        {
//            [self.navigationController pushViewController:self.moveCarMgr.viewController animated:YES];
//        }
            
            break;
            //违章查询按钮
        case Button_BreakRules:
        {
            if (![Check isVisiter]){
                ViolationCarsViewController *vc = [[[ViolationCarsViewController alloc] initWithTableRefreshType:TYPE_TABLE_REFRESH_PULL_DOWN]navSetupBackItemWithIdentification:BACK_ICON_TITLE];
                [self.navigationController pushViewController:vc animated:YES];
            }
            [UmengMgr event:ICZ_WZCarList];
            [[StatisticsMgr sharedInstance] addClickID:@"违章查询－我的车辆列表" description:sender.description];
        }
            break;
            //震动报警按钮
        case Button_ShockPolice:
            [self.navigationController pushViewController:[[[NotifiCationViewController alloc] initWithMainViewType:TYPE_MAIN_VIEW_NORMAL] navSetupBackItemWithIdentification:BACK_ICON_TITLE] animated:YES];
            break;

            //挣点商城
        case Button_MoneyMall:
        {
            __weak __typeof(self) wself = self;
            if (![Check isVisiter]) {
                [[[NetMoneyMall loadMoneyMallUrl:STRING_INT(self.refreshMgr.refreshMoney.currentMoney)] requestWithLoad:RequestLoadShowLoading|RequestLoadShowErrorTips] requestSuccess:^(id JSON) {
                    if ([JSON[@"url"] isNotNil]) {
                        //  PresentViewController 的方式
                        //  如果没有UINavigationController，就创建一个 CreditNavigationController 然后 present 出来
                        CreditWebViewController *webVC=[[CreditWebViewController alloc]initWithUrlByPresent:JSON[@"url"]];
                        [wself.navigationController pushViewController:[webVC navSetupBackItemWithIdentification:BACK_ICON] animated:YES];
                    }
                }];
                [UmengMgr event:ICZ_Point_Mall];
            }
        }
            break;
            //安全区域按钮
        case Button_SafeRegion:
        {
            __weak __typeof(self) wself = self;
            [CarFenceMgr updateFencesFinish:^{
                if ([CarFenceMgr sharedInstance].fences.count > 0 ) {
                    [wself.navigationController pushViewController:[[[CarFenceViewController alloc] initWithTableRefreshType:TYPE_TABLE_REFRESH_PULL_DOWN] navSetupBackItemWithIdentification:BACK_ICON_TITLE] animated:YES];
                }else
                {
                    CarFenceDetailViewController *vc = [[[CarFenceDetailViewController alloc] init] navSetupBackItemWithIdentification:BACK_ICON_TITLE];
                    [wself.navigationController pushViewController:vc animated:YES];
                    
                    TipsView *tipsV = [TipsView textTipsWithTitle:@"设置安全区域" lightTitles:@[@"当车辆驶出该区域时，系统自动提示，保证车辆安全"]];
                    [tipsV addOKButton:@"我知道了" clickOK:^{
                        [AlertMgr dismiss:TYPE_VIEW_ALERT];
                    }];
                    [AlertMgr showView:tipsV];
                }
            }];
            [UmengMgr event:ICZ_Fence];
        }
            
            break;
        default:
            break;
    }
    
}
- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    [self reloadLBSData];
}
-(void)viewWillAppear:(BOOL)animated{
    
    [super viewWillAppear:animated];
    [self.refreshMgr.refreshCarLocation startRefreshWithTimeInterval:0];
    [self.refreshMgr.refreshCarStatus startRefreshWithTimeInterval:0];
    [self.refreshMgr.refreshCarCondition startRefreshWithTimeInterval:0];
    [UmengMgr event:ICZ_Car];

}
-(void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    [self.refreshMgr.refreshCarLocation stopRefresh];
    [self.refreshMgr.refreshCarStatus stopRefresh];
    [self.refreshMgr.refreshCarCondition stopRefresh];
}

-(void)refreshCarStatusNotification
{
    //[NSString stringWithFormat:@"%0.0f",self.refreshCarStatus.enduranceMileage],
    NSArray * titleArray = @[(USERINFO.adaption_Oil ? [NSString stringWithFormat:@"%0.0f",self.refreshMgr.refreshCarStatus.remainFuel] : STRING_INT(self.refreshMgr.refreshCarStatus.driveNums)),
                             (USERINFO.adaption_Mileage ? [NSString stringWithFormat:@"%0.0f",self.refreshMgr.refreshCarStatus.carMiles] : STRING_INT(self.refreshMgr.refreshCarStatus.shockTims)),
                             [NSString stringWithFormat:@"%0.0f",self.refreshMgr.refreshCarStatus.enduranceMileage]
                             ];
    
    if ([USERINFO isVisiter]) {
        titleArray = @[@"10",@"50",@"10"];
    }
    for (int index = 0; index < [titleArray count]; index ++) {
        UILabel * titleLabel = [self.headView getNumLabelWithIndex:index];
        [titleLabel setText:titleArray[index]];
        
        UIImageView * cornerImageV = [self.headView getCornerImageVWithIndex:index];;
        cornerImageV.hidden = NO;

        if (index == 2)[cornerImageV setBackgroundColor:([titleArray[index] intValue] < 100 ? ([titleArray[index] intValue] < 50 ? COLOR_HEXSTRING(@"#ff7200") :COLOR_HEXSTRING(@"#ffb400") ): [Theme mainNavColor])];
        
//        if((index == [titleArray count] - 1) && SETTINGMGR.voltageValue != 0)
//        {
////            UIImageView * voiltageBangImageV = (UIImageView *)[self.headView viewWithTag:ImageV_Head_Voltage + index];
////            voiltageBangImageV.hidden = ([titleArray[index] intValue] < SETTINGMGR.voltageValue ? NO : YES);
//            cornerImageV.hidden = ([titleArray[index] intValue] < SETTINGMGR.voltageValue ? YES : NO);
//            [titleLabel setTextColor:([titleArray[index] intValue] < SETTINGMGR.voltageValue ? [Theme orangeColor] : [Theme wordColor])];
//        }
        
        if( index == 0 && USERINFO.adaption_Oil)[cornerImageV setBackgroundColor:([titleArray[index] intValue] < 10 ?  ([titleArray[index] intValue] < 1 ? COLOR_HEXSTRING(@"#ff7200") :COLOR_HEXSTRING(@"#ffb400") ): [Theme mainNavColor])];

    }
  
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
